using System;
using System.Collections.Generic;
using CoreMobile.cfg;
namespace ERIMobileL.cfg
{
    public class ELSettings : AbstractSettings
    {
        private readonly string ELEMENT_SEPARATOR = Environment.NewLine;
        private List<string> codes;

        public List<string> Codes
        {
            get { return codes; }
            set { codes = value; }
        }

        public string getCodes()
        {

                string line = "";
                foreach (var param in codes)
                {
                    line += ELEMENT_SEPARATOR + param;
                }

                return line.Substring(ELEMENT_SEPARATOR.Length);
        }
        public ELSettings parseFrom(string value)
            {
                codes =new List<string>();
                foreach (var code in value.Split(ELEMENT_SEPARATOR.ToCharArray()))
                {
                    if(! string.IsNullOrEmpty(code)) codes.Add(code);
                }
            return this;
            }

        #region Overrides of AbstractSettings

        protected override void init()
        {
            this.codes = new List<string>(new string[]{ "Entrada" , "Salida"});
        }

        #endregion
    }
}